Add sort by Wi-Fi Standard option to AccessPoints view#604
Add sort by Wi-Fi Standard option to AccessPoints view#604gioalex07 wants to merge 5 commits intoVREMSoftwareDevelopment:mainfrom
Conversation
Add STANDARD as a new SortBy option that orders access points by Wi-Fi standard descending (BE > AX > AC > N > LEGACY > UNKNOWN), with signal strength, SSID and BSSID as tiebreakers. - SortBy.kt: add sortByStandard() comparator and STANDARD enum entry - arrays.xml: add Standard option to sort_by_index_array and sort_by_array - strings.xml: add sort_by_standard string resource - SortByTest.kt: update size, ordinal and comparator assertions
|
Thanks for the contribution.
Please update the PR with real‑device testing details so review can continue. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #604 +/- ##
=========================================
Coverage 97.83% 97.83%
Complexity 975 975
=========================================
Files 121 121
Lines 2581 2586 +5
Branches 211 211
=========================================
+ Hits 2525 2530 +5
Misses 19 19
Partials 37 37 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a new Access Points sorting option to expose the existing WiFiStandard detection logic as a user-selectable sort criterion.
Changes:
- Add
STANDARDtoSortBywith a dedicated comparator (sortByStandard()). - Expose the new sort option in Settings resources (
arrays.xml,strings.xml). - Update unit tests to cover the new enum entry and comparator wiring.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| app/src/main/kotlin/com/vrem/wifianalyzer/wifi/model/SortBy.kt | Adds sortByStandard() comparator and SortBy.STANDARD entry. |
| app/src/main/res/values/arrays.xml | Adds index/label entries so Settings can display and persist the new sort option. |
| app/src/main/res/values/strings.xml | Adds the sort_by_standard label string. |
| app/src/test/kotlin/com/vrem/wifianalyzer/wifi/model/SortByTest.kt | Updates assertions for the new SortBy entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <string name="security_wps" translatable="false">"WPS"</string> | ||
| <string name="selected_menu_key" translatable="false">"selected_menu"</string> | ||
| <string name="sort_by_channel">"Channel"</string> | ||
| <string name="sort_by_standard" translatable="false">"Standard"</string> |
There was a problem hiding this comment.
sort_by_standard is marked translatable="false", but the other user-visible sort labels nearby (e.g., sort_by_channel, sort_by_signal_strength) are translatable. If this label should be localized like the others, remove translatable="false" (or otherwise align the translation policy across the sort-by labels).
| <string name="sort_by_standard" translatable="false">"Standard"</string> | |
| <string name="sort_by_standard">"Standard"</string> |
| fun sortByStandard(): Comparator<WiFiDetail> = | ||
| compareByDescending<WiFiDetail> { it.wiFiSignal.extra.wiFiStandard.wiFiStandardId } | ||
| .thenByDescending { it.wiFiSignal.level } |
There was a problem hiding this comment.
sortByStandard() currently sorts by wiFiStandardId descending, which will place 802.11ad (id=7) ahead of 802.11ax (id=6). This doesn’t match the PR description’s stated Wi‑Fi generation order (7 → 6 → 5 → 4 → Legacy → Unknown). Consider defining an explicit ranking (e.g., mapping WiFiStandard to a sort key) so the sort order matches the intended UX, and treat 11ad/WiGig explicitly (either between 7 and 6 by design, or below 6).
| <string-array name="sort_by_index_array" translatable="false"> | ||
| <item>0</item> | ||
| <item>1</item> | ||
| <item>2</item> | ||
| <item>2</item> | ||
| <item>3</item> | ||
| </string-array> |
There was a problem hiding this comment.
These newly added <item> lines are indented with tab characters, while the surrounding XML uses spaces. Please replace tabs with spaces to keep formatting consistent and avoid whitespace-only diffs/noise in future changes.
| <string-array name="sort_by_array"> | ||
| <item>@string/sort_by_signal_strength</item> | ||
| <item>@string/sort_by_ssid</item> | ||
| <item>@string/sort_by_channel</item> | ||
| <item>@string/sort_by_channel</item> | ||
| <item>@string/sort_by_standard</item> | ||
| </string-array> |
There was a problem hiding this comment.
The new entries in sort_by_array are indented with tabs, unlike the rest of this file which uses spaces. Please normalize indentation (spaces) for consistency.
Summary
STANDARDas a new sort option in the Access Points view.What does this implement/fix?
The
WiFiStandardenum and its detection logic (WiFiStandard.findOne()) were already fullyimplemented but not exposed as a sort criteria. This change adds
STANDARDtoSortByfollowingthe exact same pattern as the existing
STRENGTH,SSIDandCHANNELoptions.Sort order for
STANDARD:wiFiStandardId(BE=8 > AX=6 > AD=7 > AC=5 > N=4 > LEGACY=1 > UNKNOWN=0)Files changed:
wifi/model/SortBy.kt— addsortByStandard()comparator andSTANDARDenum entryres/values/arrays.xml— add index and label tosort_by_index_arrayandsort_by_arrayres/values/strings.xml— addsort_by_standardstring resourcewifi/model/SortByTest.kt— update size assertion, add ordinal and comparator assertionsDoes this close any issues?
How was this tested?
Checklist (required before marking ready)
app/src/test/)Additional context
On devices running Android 10 or earlier (
< Build.VERSION_CODES.R),WiFiStandardreturnsUNKNOWNfor all access points — this is existing behavior handled byWiFiStandard.findOne().The sort remains stable in that case since tiebreakers (strength, SSID, BSSID) still apply.
Note: translations for
sort_by_standardin non-English locales are not included in this PRas the string is currently marked
translatable="false"consistent withsort_by_ssidin theexisting codebase.